<style lang="scss">
	page {
		overflow: hidden;
	}

	.content {
		height: 100vh;
		width: 100%;
		display: flex;
		justify-content: center;
		align-items: center;
		background-color: black;
		color: white;

		.timeInformation {
			display: flex;
			justify-content: center;
			align-items: center;
			flex-direction: column;
			height: 50%;
			width: 70%;

			.nowTime {
				font-size: 180rpx;
			}

			.TimeRemains {
				font-size: 60rpx;
			}
		}
	}
</style>
<template>
	<view class="content" @click="jump()">
		<view class="timeInformation">
			<view class="">{{ yearMonthDay }}</view>
			<view class="nowTime">{{ now }}</view>
			<view>{{ dayOfWeek }}</view>
			<view class="">时间剩余</view>
			<view class="TimeRemains">{{ textShowM +':'+ textShowT  }}</view>
		</view>
	</view>
</template>

<script>
	import chronograph from '../../util/chronograph.js'
	export default {
		data() {
			return {
				yearMonthDay: '2023年0月00日',
				dayOfWeek: '星期一',
				now: '00:00',
				textShowM: '',
				textShowT: ''
			};
		},
		methods: {
			jump() {
				uni.navigateBack({
					delta: 1
				});
			},
			updateTime() {
				var now = new Date();
				var year = now.getFullYear();
				var month = now.getMonth() + 1;
				var day = now.getDate();
				var weekDay = now.getDay();
				var weekdays = ['天', '一', '二', '三', '四', '五', '六'];
				var dayOfWeek = weekdays[weekDay];
				var hour = now.getHours();
				var minute = now.getMinutes();
				var second = now.getSeconds();
				this.yearMonthDay = year + '年' + month + '月' + day + '日';
				this.dayOfWeek = '星期' + dayOfWeek;
				this.now = (hour < 10 ? '0' + hour : hour) + ':' + (minute < 10 ? '0' + minute : minute);
				this.textShowM = chronograph.minutes;
				this.textShowT = chronograph.remainingSeconds;
			}
		},
		created() {
			setInterval(this.updateTime, 100);
			uni.setKeepScreenOn({
				keepScreenOn: true
			});
			uni.setScreenBrightness({
				value: 0.1,
			});
		}
	}
</script>